#include "myvideosurface.h"

MyVideoSurface::MyVideoSurface(QObject *parent)
    : QAbstractVideoSurface{parent} { }



bool MyVideoSurface::present( const QVideoFrame &frame ) {
    if ( frame.isValid() ) {
        QVideoFrame cframe(frame) ;
        emit availableFrame( cframe ) ;
        return true ;
    }
    return false ;
}

QList<QVideoFrame::PixelFormat> MyVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const {
    if ( type == QAbstractVideoBuffer::NoHandle ) {
        return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_NV21
                                                 << QVideoFrame::Format_YUV420P
                                                 << QVideoFrame::Format_RGB32
                                                 << QVideoFrame::Format_ARGB32
                                                 << QVideoFrame::Format_ARGB32_Premultiplied
                                                 << QVideoFrame::Format_BGR565
                                                 << QVideoFrame::Format_BGR555 ;
    } else return QList<QVideoFrame::PixelFormat>() ;

}
